<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!--每个页面的title不一样-->
<head th:fragment="head(title)">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title th:replace="${title}">博客详情</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
    <link rel="icon" type="image/ico" sizes="144x144" href="../static/images/favicon.ico"
          th:href="@{/images/favicon.ico}"/>
    <link rel="stylesheet" href="../static/css/me.css" th:href="@{/css/me.css}">
    <link rel="stylesheet" href="../../static/lib/editormd/css/editormd.min.css"
          th:href="@{/lib/editormd/css/editormd.min.css}">
    <!--樱花背景-->
    <script src="https://api.ly522.com/js/yinghua.js"></script>
    <!--点击花花-->
    <script src="https://cdn.jsdelivr.net/gh/Sanarous/files@1.151/js/click.min.js"></script>

</head>
<body>

<!--导航-->
<nav th:fragment="menu(n)" class="ui inverted attached segment m-padded-tb-mini  m-shadow-small">
    <div class="ui container">
        <div class="ui inverted secondary stackable menu">
            <h2 class="ui teal header secondary item">管理后台</h2>
            <a href="#" th:href="@{/admin/blogs}" class="m-item item m-mobile-hide" th:classappend="${n==1} ? 'active'"><i
                    class="idea icon"></i>博客</a>
            <a href="#" th:href="@{/admin/types}" class="m-item item m-mobile-hide" th:classappend="${n==2} ? 'active'"><i
                    class="tags icon"></i>分类</a>
            <a href="#" th:href="@{/admin/tags}" class="m-item item m-mobile-hide"
               th:classappend="${n==3} ? 'active'"><i class="tags icon"></i>标签</a>
            <div class="right m-item m-mobile-hide menu">
                <div class="ui dropdown item">
                    <div class="text">
                        <img class="ui avatar image" th:src="@{${session.user.avatar}}">
                        <span th:text="${session.user.nickname}"><b>李桃</b></span>
                    </div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <a href="#" th:href="@{/admin/logout}" class="item">注销</a>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <a href="#" class="ui menu toggle grey icon button m-top-right m-mobile-show">
        <i class="sidebar icon"></i>
    </a>

</nav>

<!--底部footer-->
<footer th:fragment="footer" class="ui inverted divided vertical segment m-padded-tb-massive">
    <div class=" ui stackable center aligned container">
        <div class="ui inverted divided stackable grid">
            <!--二维码-->
            <div class="three wide column">
                <div class="ui inverted link list">
                    <div class="item">
                        <img src="../static/images/wechat.jpg" th:src="@{/images/wechat.jpg}" class="ui rounded"
                             style="width: 130px" alt="">
                    </div>
                </div>
            </div>

            <div class="three wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced">博客信息</h4>
                <div id="newblog-container">
                    <span id="htmer_time" style="color: orange"></span>
                </div>
            </div>

            <div class="three wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced">联系我</h4>
                <div class="ui inverted link list">
                    <a href="#" class="item">Email: 1490477595@qq.com</a>
                    <a href="#" class="item">QQ: 1490477595</a>
                </div>
            </div>

            <div class=" seven wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced">博猪寄语</h4>
                <p class="m-text-thin m-text-spaced m-opacity-mini">
                    你遇到的每个人都是别人想见又见不到的人，请珍惜每一刻相处的时光，因为我们不知道哪一次再见，会变成再也不见。</p>
            </div>
        </div>
        <!--线条-->
        <div class="ui inverted section divider"></div>
        <p class="m-text-thin m-text-spaced m-opacity-small">Copyright © 2020 - 2021 AndyLee</p>
    </div>

    <script>

        function secondToDate(second) {
            if (!second) {
                return 0;
            }
            var time = new Array(0, 0, 0, 0, 0);
            if (second >= 365 * 24 * 3600) {
                time[0] = parseInt(second / (365 * 24 * 3600));
                second %= 365 * 24 * 3600;
            }
            if (second >= 24 * 3600) {
                time[1] = parseInt(second / (24 * 3600));
                second %= 24 * 3600;
            }
            if (second >= 3600) {
                time[2] = parseInt(second / 3600);
                second %= 3600;
            }
            if (second >= 60) {
                time[3] = parseInt(second / 60);
                second %= 60;
            }
            if (second > 0) {
                time[4] = second;
            }
            return time;
        }

        function setTime() {
            /*此处为网站的创建时间*/
            var create_time = Math.round(new Date(Date.UTC(2021, 2, 24, 12, 59, 1)).getTime() / 1000);
            var timestamp = Math.round((new Date().getTime() + 8 * 60 * 60 * 1000) / 1000);
            currentTime = secondToDate((timestamp - create_time));
            currentTimeHtml = '本站已运行：' + currentTime[0] + '年' + currentTime[1] + '天'
                + currentTime[2] + '时' + currentTime[3] + '分' + currentTime[4]
                + '秒';
            document.getElementById("htmer_time").innerHTML = currentTimeHtml;
        }

        setInterval(setTime, 1000);


    </script>
</footer>

<th:block th:fragment="script">
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
    <script src="../../static/lib/editormd/editormd.min.js" th:src="@{/lib/editormd/editormd.min.js}"></script>
</th:block>


</body>
</html>
